<template>
  <div class="attendance">
<!--    type="point"-->
    <Scheduling :type="type" :pointData="pointData"></Scheduling>
  </div>
</template>

<script>
import Scheduling from "@/components/pointsManage/Scheduling";

export default {
  name: "pointLine",
  components: {Scheduling},
  props:['type', 'pointData'],
  data() {
    return {
      options: [],
      value: '',
      monthThis: '',
      dayMonth: [],
      attenVisible: false
    }
  },
  created() {
    let tiem_ = this.newDate().split('-')
    this.monthThis = tiem_.join('-')
    this.getDaysOfWeek(tiem_[0], tiem_[1])
  },
  methods: {
    getDaysOfWeek(year, month) {
      let week = ['日', '一', '二', '三', '四', '五', '六']
      let dayMonth = []
      let d = new Date(year, month, 0)
      let day = d.getDate();
      this.widthTable = day * 60 + 100
      let firstDayOfMonth = new Date(year, month - 1, 1)
      //该月第一天是周几?0表示周日，1表示周一...6表示周六
      let dayWeek = firstDayOfMonth.getDay()
      for (let i = 0; i < day; i++) {
        dayMonth.push({
          day: `${year}-${month}-${i + 1}`,
          dayOne: i + 1,
          week: week[dayWeek],
          dayName: i + 1
        })
        dayWeek++
        if (dayWeek > 6) {
          dayWeek = 0
        }
      }
      this.dayMonth = dayMonth
      console.log('this.dayMonth:', this.dayMonth)
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    monthThisFn() {

    },
    newDate() {
      let date = new Date()
      let y = date.getFullYear()
      let m = date.getMonth() + 1
      m = m < 10 ? '0' + m : m
      return y + '-' + m
    },
  }
}
</script>

<style scoped>
.attendance-body {
  overflow-x: auto;
}

.attendance-box-thead {
  display: flex;
  font-size: 12px;
  text-align: center;
  border: 1px solid #f4f4f4;
  padding: 5px 0;
}

.attendance-box-th {
  display: flex;
  flex-direction: column;
  width: 70px;
}

.attendance-box-tdbox {
  overflow-x: auto;
  display: flex;
}

.attendance-box-tdLine {
  width: 70px;
  text-align: center;
  font-size: 13px;
}

.attendance-box-tdLine-box {
  padding: 5px 0;
  cursor: pointer;
  color: #ffba00;
}

.attendance-box-tdLine-box:hover {
  background: #f4f4f4;
}
</style>
